From: Keir Fraser Date: Wed, 3 Mar 2010 17:41:58 +0000 (+0000) Subject: x86-64: fix hotplug fault handling for 32-bit domains' M2P range X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~12545 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=ed6d398c333c57587ddafebca1526fdccbf9bf76;p=xen.git x86-64: fix hotplug fault handling for 32-bit domains' M2P range - handle only when memory hotplug regions were actually found - fix off-by-one error in fault handler's sanity checking - use first L4 table entry Signed-off-by: Jan Beulich --- diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c index caccc0b1e5..71d0a11ea5 100644 --- a/xen/arch/x86/x86_64/mm.c +++ b/xen/arch/x86/x86_64/mm.c @@ -1213,12 +1213,9 @@ int pagefault_by_memadd(unsigned long addr, struct cpu_user_regs *regs) { struct domain *d = current->domain; - if (guest_mode(regs) && - is_pv_32bit_domain(d) && - ((addr >= HYPERVISOR_COMPAT_VIRT_START(d)) && - (addr < MACH2PHYS_COMPAT_VIRT_END)) ) - return 1; - return 0; + return mem_hotplug && guest_mode(regs) && is_pv_32bit_domain(d) && + (addr >= HYPERVISOR_COMPAT_VIRT_START(d)) && + (addr < MACH2PHYS_COMPAT_VIRT_END); } int handle_memadd_fault(unsigned long addr, struct cpu_user_regs *regs) @@ -1236,15 +1233,15 @@ int handle_memadd_fault(unsigned long addr, struct cpu_user_regs *regs) if (!is_pv_32on64_domain(d)) return 0; - if ((addr < HYPERVISOR_COMPAT_VIRT_START(d)) || - (addr > MACH2PHYS_COMPAT_VIRT_END) ) + if ( (addr < HYPERVISOR_COMPAT_VIRT_START(d)) || + (addr >= MACH2PHYS_COMPAT_VIRT_END) ) return 0; mfn = (read_cr3()) >> PAGE_SHIFT; pl4e = map_domain_page(mfn); - l4e = pl4e[addr]; + l4e = pl4e[0]; if (!(l4e_get_flags(l4e) & _PAGE_PRESENT)) goto unmap;